package com.anycl.design.behavioral.mediator.instance;

/**
 * 具体中介公司
 */
public class ConcreteMediatorCompany extends MediatorCompany {
    public ConcreteMediatorCompany(String name) {
        super(name);
    }

    @Override
    public void publish(String message, Colleague colleague) {
        if (colleague instanceof ColleagueSeller) {
            buyer.accept(message);
        } else if (colleague instanceof  ColleagueBuyer) {
            seller.accept(message);
        }
    }
}
